<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">



<ui:composition template="/paginas/templates/commonLayout.xhtml">
	
	
<ui:define name="title">
	Cadastro de Processo
</ui:define>

	<ui:define name="content">

		<p:panel style="text-align: center;">
			<h2>Cadastrar Processo</h2>
		</p:panel>
		<br />

		<h:form id="form">
			<p:growl id="growlProcesso" showDetail="false" sticky="false"
				life="6000" />
			<p:panel id="panelProcesso" columns="4">
				<h:panelGrid columns="2" cellpadding="5">

					<h:outputLabel for="numeroProcesso" value="Nº do Processo:" />
					<p:inputText id="numeroProcesso"
						value="#{processoBean.processo.numero}" required="true"
						requiredMessage="O número do processo é obrigatório!"
						converterMessage="Campo 'Número do Processo' é Numérico."
						maxlength="25" size="25">
						<f:convertNumber integerOnly="true" minIntegerDigits="1" />
					</p:inputText>

					<h:outputLabel for="dataProcesso" value="Data de Elaboração:" />
					<p:calendar id="dataProcesso" locale="pt" pattern="dd/MM/yyyy"
						showButtonPanel="true" navigator="true" required="true"
						requiredMessage="A data do processo é obrigatória!"
						value="#{processoBean.processo.data}" size="10" />

					<h:outputLabel value="Observação:" for="obsProcesso" />
					<p:inputTextarea id="obsProcesso" rows="3" cols="70" maxLength="255"
						value="#{processoBean.processo.observacao}" />

					<h:outputLabel value="Enviar Arquivo:" />
					<p:fileUpload label="Escolher" cancelLabel="Cancelar"
						widgetVar="fileEditalUploader" uploadLabel="Enviar"
						fileUploadListener="#{processoBean.handleFileUpload}"
						mode="advanced" update=":form:growlProcesso" sizeLimit="1000000"
						allowTypes="/(\.|\/)(gif|jpe?g|png|pdf|doc?x)$/" />

				</h:panelGrid>

			</p:panel>

			<br />

			<p:commandButton value="#{processoBean.processo.atualizacao ? 'Atualizar' : 'Salvar'}" ajax="false" icon="ui-icon-disk"
				action="#{processoBean.salvarProcesso}" />
			
		</h:form>
		<br />

		<h:form id="formExterno">
			<p:commandButton value="Cancelar" ajax="false"
				icon="ui-icon-circle-close"
				action="/paginas/menu?faces-redirect=true" />
		</h:form>
		<br />


	</ui:define>

</ui:composition>


</html>